CTRL_SRCS-y += xc_sedf.c
CTRL_SRCS-y += xc_csched.c
CTRL_SRCS-y += xc_tbuf.c
+CTRL_SRCS-y += xc_resume.c
CTRL_SRCS-$(CONFIG_X86) += xc_pagetab.c
CTRL_SRCS-$(CONFIG_Linux) += xc_linux.c
CTRL_SRCS-$(CONFIG_SunOS) += xc_solaris.c
}
-int xc_domain_resume(int xc_handle,
- uint32_t domid)
-{
- DECLARE_DOMCTL;
- domctl.cmd = XEN_DOMCTL_resumedomain;
- domctl.domain = (domid_t)domid;
- return do_domctl(xc_handle, &domctl);
-}
-
-
int xc_vcpu_setaffinity(int xc_handle,
uint32_t domid,
int vcpu,
}
int xc_vcpu_getcontext(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- vcpu_guest_context_t *ctxt)
+ uint32_t domid,
+ uint32_t vcpu,
+ vcpu_guest_context_t *ctxt)
{
int rc;
DECLARE_DOMCTL;
unlock_pages(ctxt, sizeof(*ctxt));
return rc;
-
}
int xc_domain_irq_permission(int xc_handle,
--- /dev/null
+#include "xc_private.h"
+
+/*
+ * Resume execution of a domain after suspend shutdown.
+ * This can happen in one of two ways:
+ * 1. Resume with special return code.
+ * 2. Reset guest environment so it believes it is resumed in a new
+ * domain context.
+ * (2) should be used only for guests which cannot handle the special
+ * new return code. (1) is always safe (but slower).
+ *
+ * XXX Only (2) is implemented below. We need to use (1) by default!
+ */
+int xc_domain_resume(int xc_handle, uint32_t domid)
+{
+ vcpu_guest_context_t ctxt;
+ DECLARE_DOMCTL;
+ int rc;
+
+ /*
+ * Set hypercall return code to indicate that suspend is cancelled
+ * (rather than resuming in a new domain context).
+ */
+#if defined(__i386__) || defined(__x86_64__)
+ if ( (rc = xc_vcpu_getcontext(xc_handle, domid, 0, &ctxt)) != 0 )
+ return rc;
+ ctxt.user_regs.eax = 1;
+ if ( (rc = xc_vcpu_setcontext(xc_handle, domid, 0, &ctxt)) != 0 )
+ return rc;
+#endif
+
+ domctl.cmd = XEN_DOMCTL_resumedomain;
+ domctl.domain = domid;
+ return do_domctl(xc_handle, &domctl);
+}
* @return 0 on success, -1 on failure
*/
int xc_vcpu_getcontext(int xc_handle,
- uint32_t domid,
- uint32_t vcpu,
- vcpu_guest_context_t *ctxt);
+ uint32_t domid,
+ uint32_t vcpu,
+ vcpu_guest_context_t *ctxt);
typedef xen_domctl_getvcpuinfo_t xc_vcpuinfo_t;
int xc_vcpu_getinfo(int xc_handle,